#ifndef _COMMON_H_
#define _COMMON_H_
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <sys/select.h>
#include <signal.h>
#include <unistd.h>
#include <strings.h>
#include <arpa/inet.h>

#define BUF_SIZE 1024  //BUF的大小
#define TEN_MIN 10*60  //10分钟超时时间

//系统错误枚举
typedef enum
{
    SYS_ERROR=-1,         //错误
    SYS_OK=0,             //成功
    SYS_DEVICE_REINSERT=1,//先删除旧设备信息再重新插入新设备信息
    SYS_UPDATE_MAX_FD=2   //更新select监听范围
}SYS_ERR;

//设备命令结构体
typedef struct
{
    unsigned char head;   //命令头0xFF
    unsigned char devID;  //设备ID
    unsigned char devType;//设备类型
    unsigned char majorCmd;//命令分类
    unsigned char minCmd;  //命令码
    unsigned char cmdVal;  //命令值
    unsigned char reserve1;//保留
    unsigned char reserve2;//保留
    unsigned char tail;    //命令尾
}Cmd;

int FillArgv(char *p,char *argv[],int *pCount);



#endif
